<template>
    <div class="bg-20">
        <div v-for="comment in comments" class="p-3 flex justify-between">
            <div>
                <a :href="'/users/'+comment.user.id">{{comment.user.name}}</a>：{{comment.content}}
            </div>
            <div class="flex">
                <div class="text-sm text-70">{{comment.created_at}}</div>
                <tig-form :action="'/comments/'+comment.id " :is-delete="true" v-if="currentUserId == chapterUserId || comment.user_id == currentUserId">
                    <button type="submit" class="hover:text-danger text-sm  block">删除</button>
                </tig-form>
            </div>

        </div>

    </div>
</template>

<script>
    export default {
        name: "TigRepositoryChapterComments", props: {comments: Array, chapterUserId: Number,currentUserId:Number}
    }
</script>